package kr.saeildamil.androidstudy.example02;

import kr.saeildamil.androidstudy.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class CalActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ex2_cal);
	}
	public void mOnClick(View v){
		EditText lvalue = (EditText)findViewById(R.id.ex2_cal_et_l_value);
		EditText rvalue = (EditText)findViewById(R.id.ex2_cal_et_r_value);
		int result = Integer.parseInt(lvalue.getText().toString()) + Integer.parseInt(rvalue.getText().toString());
		Intent putIntent = new Intent();
		putIntent.putExtra("result", lvalue.getText().toString() + "+" + rvalue.getText().toString() + "=" + result);
		setResult(RESULT_OK,putIntent);
		finish();
		
	}
}
